home *** CD-ROM | disk | FTP | other *** search
/ Internet Tools (InfoMagic) / Internet Tools.iso / news / moderating / posting.Z / posting
Internet Message Format  |  1994-05-06  |  4KB

  1. From owner-moderators@uunet.uu.net Wed Apr 20 16:36:36 1994
  2. Received: from uunet.UUCP by sparky.sterling.com 
  3.     id AA22710; Wed, 20 Apr 1994 16:36:35 -0500
  4. Return-Path: <owner-moderators@uunet.uu.net>
  5. Received: by rodan.UU.NET (5.61/UUNET-mail-drop)
  6.     id AA27786; Wed, 20 Apr 94 17:19:24 -0400
  7. Received: from relay1.UU.NET by rodan.UU.NET with SMTP 
  8.     (5.61/UUNET-mail-drop) id AA27781; Wed, 20 Apr 94 17:19:20 -0400
  9. Received: from introl.introl.com by relay1.UU.NET with SMTP 
  10.     (5.61/UUNET-internet-primary) id AAwmmn15122; Wed, 20 Apr 94 17:19:12 -0400
  11. Received: (from tjk@localhost) by introl.introl.com (8.6.8/8.6.6) id QAA24305; Wed, 20 Apr 1994 16:18:14 -0500
  12. Message-Id: <199404202118.QAA24305@introl.introl.com>
  13. From: tjk@introl.introl.com (Thomas Krueger)
  14. Date: Wed, 20 Apr 1994 16:18:14 -0500
  15. In-Reply-To: Joel Furr <jfurr@acpub.duke.edu>
  16.        "Posting script" (Apr 20,  4:59pm)
  17. X-Mailer: Mail User's Shell (7.2.5 10/14/92)
  18. To: Joel Furr <jfurr@acpub.duke.edu>
  19. Subject: Re: Posting script
  20. Cc: moderators@uunet.uu.net
  21. Status: OR
  22.  
  23. I use mush to pipe each message to this script:
  24.  
  25. dir='/u/tjk/newsgroup'
  26. digest='/u/tjk/digest'
  27.  
  28. mv /u/tjk/.signature /u/tjk/.si
  29. awk -f $dir/script.awk > $dir/body.$$
  30. grep -i "from:" $dir/body.$$ >> $dir/logfile
  31. grep -i "subject:" $dir/body.$$ >> $dir/logfile
  32. cat $dir/Headers $dir/body.$$ > $dir/article.$$
  33. /usr/ucb/head $dir/article.$$ < /dev/tty
  34. echo " "
  35. /bin/echo -n "Are you sure you want to post this? "
  36. read answer < /dev/tty
  37. echo " "
  38.  
  39. if [ "$answer" = "no" -o "$answer" = "n" ]
  40. then
  41.   echo posting cancelled.
  42.   /bin/rm -f $dir/article.$$ $dir/body.$$
  43.   mv /u/tjk/.si /u/tjk/.signature
  44.   exit 0
  45. fi
  46. cat $dir/article.$$ | /usr/local/news/inews -h >> $dir/logfile
  47. echo -n "From zoo " >> $digest/outbound
  48. echo `date` >> $digest/outbound
  49. cat $dir/article.$$ >> $digest/outbound
  50. echo "" >> $digest/outbound
  51. rm -f $dir/body.$$ $dir/article.$$
  52. mv /u/tjk/.si /u/tjk/.signature
  53. ---
  54. This is the awk script:
  55.  
  56. #
  57. # Awk Script called by 'digest'.  See DIGEST(1)
  58. #
  59. # Version two - sucks in the '>From' lines too...
  60. #               (guarantees a "valid" return address!)
  61.  
  62. BEGIN {
  63.     message = 0;
  64.     last = "this should never be matched"
  65.     in_header = 1;
  66.         have_from = 0;
  67.       }
  68.  
  69. $1 ~ /^From$/    { 
  70.             message++;
  71.                 in_header = 1;
  72.                 from = $2;
  73.             parse_count = 0;
  74.                 have_from = 0;
  75.             last = "we should have a hard time matching this, too"
  76.              }
  77.  
  78. $1 ~ /^From:/    { if (in_header) print $0; 
  79.            have_from = 1 }
  80. $1 ~ /^>From/     { parse_count++;
  81.            address = $2
  82.            if (parse_count > 1)
  83.              from = from"!"$10
  84.                else
  85.              from = $10
  86.          }
  87. $1 ~ /^Subject:/ { if (in_header) print $0 }
  88. $1 ~ /^Reply-To:/ { if (in_header) print $0 }
  89. $1 ~ /^References:/    { if (in_header) print $0 }
  90. $1 ~ /^Organization:/    { if (in_header) print $0 }
  91. $1 ~ /^Date:/    { if (in_header) print $0 }
  92.  
  93. length($0) < 2   { 
  94.                if (in_header == 1)
  95.                  if (have_from == 0)
  96.                print "From: "from"!"address
  97.  
  98.            if ($0 != last)
  99.              print $0
  100.            in_header = 0
  101.            last = $0
  102.              }
  103.  
  104. in_header == 0   { if ($0 != last) 
  105.                      print $0
  106.            last = $0 
  107.          }
  108. ---
  109. The extra stuff in there to put things into an additional "mailbox" is so 
  110. I can then send out the saved stuff as a digest later.
  111.  
  112.                                                 - Tom
  113.  
  114.   Thomas Krueger              Introl Corporation                   Moderator:
  115.   Technical Writer          9220 West Howard Avenue        rec.audio.high-end
  116.   +1 (414) 327-7171         Milwaukee WI 53228-1644          and Mystery list
  117.  
  118.